package 命令设计模式;

// 命令调用者 - 相当于遥控器
public class CommandInvoker {

    private Command onCommand;
    private Command offCommand;

    public Command getOnCommand() {
        return onCommand;
    }

    public void setOnCommand(Command onCommand) {
        this.onCommand = onCommand;
    }

    public Command getOffCommand() {
        return offCommand;
    }

    public void setOffCommand(Command offCommand) {
        this.offCommand = offCommand;
    }

    public void on() {
        onCommand.execute();
    }


    public void off() {
        offCommand.execute();
    }
}
